package com.dingteam.question.common.validation.module.option;

import com.dingteam.model.Result;
import com.dingteam.question.common.dto.QuestionPaperVerifyDTO;
import com.dingteam.question.common.dto.QuestionResultVerifyDTO;
import com.dingteam.question.common.enums.ModuleEnum;
import com.dingteam.question.common.validation.module.AbstractModuleOptionValidator;
import lombok.Getter;
import org.springframework.stereotype.Component;

/**
 * @author Jamin
 * @date 2019/08/20
 */
@Component
public class RadioSelectValidator extends AbstractModuleOptionValidator {

	@Getter
	private final ModuleEnum module = ModuleEnum.RADIO_SELECT;

	@Override
	public boolean supportModule(ModuleEnum module) {
		return this.module.equals(module);
	}

	@Override
	public Result<String> createValid(QuestionPaperVerifyDTO.QuestionItemDTO itemDTO) {
		return validCreateRadio(itemDTO);
	}

	@Override
	public Result<String> submitValid(QuestionResultVerifyDTO.ItemResultDTO item) {
		return validSubmitRadio(item);
	}
}
